﻿namespace libsemtd
{
    public partial class Semtd
    {
        private void draw(string graphType, int start, int end, params int[] ver_others)
        {
            if (end < start)
            {
                int temp = start;
                start = end;
                end = temp;
            }
            switch (graphType)
            {
                case "path":
                    {
                        for (int i = start; i < end; i++)
                            connectVertices(i, i + 1);
                        break;
                    }
                case "cycle":
                    {
                        draw("path", start, end);
                        connectVertices(start, end);
                        break;
                    }
                case "completebipartite":
                    {
                        for (int i = start; i <= end; i++)
                            foreach (int other in ver_others)
                                connectVertices(i, other);
                        break;
                    }
                case "wheel":
                    {
                        draw("cycle", start + 1, end);
                        draw("completebipartite", start + 1, end, start);
                        break;
                    }
                case "fan":
                    {
                        draw("path", start + 1, end);
                        draw("completebipartite", start + 1, end, start);
                        break;
                    }
                case "doublefan":
                    {
                        draw("path", start + 2, end);
                        draw("completebipartite", start + 2, end, start, start + 1);
                        break;
                    }
            }
        }
        private void connectVertices(int a, int b)
        {
            if (!this.graphConn[a, b])
            {
                this.graphConn[a, b] = this.graphConn[b, a] = true;
                this.numEdges++;
            }
        }
    }
}
